import 'package:flutter/material.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import '../widgets/AppColors.dart';

class ModuleItem extends StatelessWidget {
  final String title;
  final String icon;
  final int index;
  final String content;
  final double w;

  const ModuleItem(
      {Key? key,
      required this.title,
      required this.icon,
      required this.index,
      required this.content,
      required this.w})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 137,
      decoration: BoxDecoration(
        color: AppColors.cardColor,
        borderRadius: BorderRadius.circular(8),
      ),
      child: Stack(
        children: [
          Positioned(
            top: 8,
            left: 8,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                TDText(title,
                    textAlign: TextAlign.left,
                    font: TDTheme.of(context).fontBodyLarge,
                    textColor: AppColors.textPrimary),
                const SizedBox(height: 4),
                Container(
                  width: w,
                  child: TDText(content,
                      textAlign: TextAlign.left,
                      font: TDTheme.of(context).fontBodySmall,
                      textColor: AppColors.textSecondary,
                      maxLines: 3,
                      overflow: TextOverflow.visible),
                ),
                const SizedBox(height: 4),
              ],
            ),
          ),

          Container(
            width: double.infinity,
            padding: EdgeInsets.only(top: 70, right: 10),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                Image.asset(icon, width: 36, height: 36),
              ],
            ),
          ),
          // Positioned(
          //   bottom: 8,
          //   right: 8,
          //   child:
          // ),
        ],
      ),
    );
  }
}
